<template>
	<view class="page">
		<u-sticky>
		<view class="logo">
			<view class="logo-inner">
				<slot name="logo">
					<image src="../../static/logo2.png" mode="aspectFit"></image>
					<view class="title">{{ title }}</view>
				</slot>
			</view>
		</view>
		</u-sticky>
		<view class="menus">
			<u-cell-group class="menus1">
				<u-cell icon="grid-fill" title="终端绑定" :isLink="true"
					url="/pages/device_binding/device_binding"></u-cell><!-- attach -->
				<u-cell icon="setting-fill" title="终端位置配置" :isLink="true"
					url="/pages/device_location/device_location"></u-cell>
				<u-cell icon="attach" title="V4集控绑定" :isLink="true" url="/pages/control_setting/control_v4"></u-cell>
				<u-cell icon="file-text-fill" title="上下线记录" :isLink="true"
					url="/pages/device_iplog/device_iplog"></u-cell>
				<u-cell icon="info-circle-fill" title="预警信息" :isLink="true" url="/pages/warning/warning"></u-cell>
				<u-cell icon="list" title="所属项目" :isLink="true" url="/pages/order_list/order_list"></u-cell>
				<u-cell icon="volume-fill" title="系统消息" :isLink="true" url="/pages/msg/msg"></u-cell>
				<u-cell icon="zhihu-circle-fill" title="知识库" :isLink="true" url="/pages/knowledge/knowledge"></u-cell>
				<u-cell icon="email-fill" title="意见反馈" :isLink="true" url="/pages/feedback/feedback"></u-cell>
				<u-cell icon="lock-fill" title="修改密码" :isLink="true" url="/pages/pwd/pwd"></u-cell>
				<u-cell icon="account-fill" title="退出登录" :isLink="true" url="/pages/login/login"></u-cell>
				<u-cell icon="level" title="关于" :isLink="false" :value="version"></u-cell>
			</u-cell-group>
		</view>
		<tabbar :current="4"></tabbar>
	</view>
</template>

<script>
	import {
		user_info
	} from '@/api/common.js';
	import {
		version
	} from "vue";
	export default {
		data() {
			return {
				title: "",
				version: '',
			}
		},
		onLaunch() {
			uni.hideTabBar({})
		},
		onShow() {
			uni.hideTabBar({})
		},
		onLoad() {
			console.log("onLoad");
			this.userinfo();
			this.getAppVersion();
		},
		methods: {
			getAppVersion() {
				// 获取当前app的版本
				const systemInfo = uni.getSystemInfoSync();
				// 应用程序版本号
				// 条件编译，只在H5渲染
				// #ifdef H5
				console.log(systemInfo.appVersion, '版本号');
				this.version = systemInfo.appVersion;
				// #endif
				// #ifdef APP
				console.log(systemInfo.appWgtVersion, 'app版本号')
				this.version = systemInfo.appWgtVersion;
				// #endif
				// #ifdef MP-WEIXIN
				const accountInfo = wx.getAccountInfoSync();
				console.log(systemInfo)
				console.log(accountInfo.miniProgram.version, '小程序版本号'+systemInfo.appVersion)
				this.version = systemInfo.appVersion;
				// #endif
			},
			userinfo() {
				user_info().then(res => {
					this.title = res.userName;
				}).catch(err => {
					console.log(err);
					uni.showToast({
						title: err,
						icon: 'none'
					});
				})
				// let user = uni.getStorageSync('User')
				// console.log("用户信息：" + user)
				// if (user != '') {
				// 	this.login = true
				// 	this.title = user
				// 	console.log("用户信息22：" + this.userinfo.name)
				// }
			},
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		padding: 0%;
		width: 100vw;
		margin-top: 0rpx;
		position: relative;
	}

	.logo {
		@include flex(center);
		height: 30vh;
		// background: linear-gradient(90deg,#fff 0%,#bbb 49%,#bbb 51%,#fff 100%);
		background: radial-gradient(circle farthest-side at 0% 0%, #ffffff, $bg-color);

		.logo-inner {
			@include flex();
			flex-direction: column;

			image {
				width: 420rpx;
				height: 160rpx;
			}

			.title {
				width: 100vw;
				margin-right: 20rpx;
				text-align: right;
				margin-top: 1vh;
				font-size: 36rpx;
				color: #fff;
			}
		}
	}

	.menus {
		position: relative;
		bottom: 6vh;
		// margin-bottom: 6vh;
		padding-top: 6vh;
	}
</style>